function handleData (data) {
  console.log (data);
}
const jsonpFunction = () => {
  const url = 'http://example.com/api?callback=handleData';
  const script = document.createElement ('script');
  script.type = 'text/javascript';
  script.src = url;
  document.head.appendChild (script);
  handleData ('{"username": "aicoder", "age": 28}');
  script.onload = function () {
    document.body.removeChild (script);
  };
};

export default jsonpFunction;
